import logging

from config import BASE_HOST


class OpenAccountApi:

    def __init__(self,ses):
        self.ses = ses

    # 实名认证接口
    def realname(self, realname_v, cardId_v):
        url = BASE_HOST+"/member/realname/approverealname"
        # 实现接口请求，获取响应结果
        dict_all = {"realname":realname_v,"card_id":cardId_v}
        resp = self.ses.post(url=url,data=dict_all,files={"a":"b"})
        # 将响应体的数据打印到日志
        logging.info(f"实名认证的接口响应 {resp.text}")
        # 封装方法的返回
        return resp
    # 开户接口
    def open_account(self):
        url = BASE_HOST +"/trust/trust/register"
        resp = self.ses.post(url)
        logging.info(f"开户接口的响应信息{resp.json()}")
        return resp


    # 第三方开户接口
    def third_open_account(self, url, form_dict):
        resp = self.ses.post(url,data=form_dict)
        logging.info(f"第三方开户接口的响应信息{resp.text}")
        return resp
